package com.bm.server.service.impl;

import com.bm.common.dto.ScripDto;
import com.bm.common.util.Rutils;
import com.bm.common.vo.R;
import com.bm.server.dao.ScripDao;
import com.bm.server.entity.Scrip;
import com.bm.server.service.intf.ScripService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * YoungMan, may the force be with you.
 *
 * @Author: 吃个小布丁吧
 * @Date: 2022/07/21/17:01
 */
@Service
public class ScripServiceImpl implements ScripService {
    @Resource
    private ScripDao dao;
    @Override
    public R add(ScripDto dto) {
            Scrip scrip = new Scrip(dto.getUid(),dto.getText());

            dao.insert(scrip);
            return Rutils.ok("成功发送小纸条");

    }

    @Override
    public R selectNewThree() {
        return Rutils.ok(dao.selectNewThree());
    }

    @Override
    public R selectAll() {
        return Rutils.ok(dao.selectList(null));
    }
}
